<?php
/**
 * IndexController - The default controller class
 *
 * @author
 * @version
 */

class TopicController extends App_Zend_Controller_Action_Shop
{

    
    public function blackfridayAction(){
    	$this->view->styleName = 'blackfriday';
    	$this->view->webSiteTitle = 'Cyber Monday Soccer Jersey, Black Friday Soccer Jersey, 50% OFF for all, Free shipping on all orders';
    	$this->view->webSiteDescription = 'Shop for Soccer Jerseys at fancycheapjersey on Cyber Monday! UP to 60% OFF for All Jerseys. Free Shipping on all Soccer Jerseys!';
    	$this->view->webSiteKeywords = "Cyber Monday Soccer, Cyber Monday Soccer Jersey, Free Shipping";
    	$keywords = new Ckeywords();
    	$this->getHelper('Fenlei')->getCategories();
    	$allKeywordList = $keywords->getAllKeywordsForBlackFriday();
    	$keywordsMap = array();
    	foreach($allKeywordList as $keyword){
			$c = substr($keyword['keywords'],0,1);
			$n = ord(strtoupper($c));
			if($n<65||$n>92){
				$array = $keywordsMap['Digital'];
				if(is_array($array)){
					$keywordsMap['Digital'][]=$keyword;
				}else{
					$keywordsMap['Digital'] = array($keyword);
				}
			}else{
				$array = $keywordsMap[strtoupper($c)];
				if(is_array($array)){
					$keywordsMap[strtoupper($c)][]=$keyword;
				}else{
					$keywordsMap[strtoupper($c)] = array($keyword);
				}
			}
		}
		$this->view->keywordsMap = $keywordsMap;
		
		$where="is_showed=1 and zcshop_products.onsales=0";
        $itemShow=new CItemShow();
        $itemShow->setType('product');
        $itemShow->setWhere($where);
        $itemCounts=$itemShow->getAllItemCounts();
        $itemShow->setFromTo(array('counts'=>12,'from'=>0));
        $myorder = R_PRE."items.view_num DESC";
        $itemShow->setOrder($myorder);
        $itemArray=$itemShow->getAllItems();
        $this->view->assign('hotItemArray',$itemArray);
    }
    
    public function christmasAction(){
    	$this->view->styleName = 'blackfriday';
    	$this->view->webSiteTitle = 'Christmas Soccer 2012, Christmas Soccer Jersey 2012, Christmas Soccer Jersey Gifts';
    	$this->view->webSiteDescription = 'Save up to 60% for All Jerseys. Best Deals and Best Gifts for Christmas! Christmas Big Sale! Great Gifts for you! ';
    	$this->view->webSiteKeywords = "Christmas Soccer 2012, Christmas Soccer Jersey 2012, Christmas Soccer Jersey Gifts, Christmas Big Sale, Free Shipping";
    	$keywords = new Ckeywords();
    	$this->getHelper('Fenlei')->getCategories();
    	
		
		$where="is_showed=1 and zcshop_products.onsales=0";
        $itemShow=new CItemShow();
        $itemShow->setType('product');
        $itemShow->setWhere($where);
        $itemCounts=$itemShow->getAllItemCounts();
        $itemShow->setFromTo(array('counts'=>24,'from'=>0));
        $myorder = R_PRE."items.view_num DESC";
        $itemShow->setOrder($myorder);
        $itemArray=$itemShow->getAllItems();
        $this->view->assign('hotItemArray',$itemArray);
        
        $csearch = new CSearch();
		$relatedKeywordList = $csearch->searchKey('holiday,merry christmas,festival,weekend,vacation,Xmas,resolution,Jesus,sexy,smart,gift', 'any', 300);
    	
    	$keywordsMap = array();
    	foreach($relatedKeywordList as $keyword){
			$c = substr($keyword['keywords'],0,1);
			$n = ord(strtoupper($c));
			if($n<65||$n>92){
				$array = $keywordsMap['Digital'];
				if(is_array($array)){
					$keywordsMap['Digital'][]=$keyword;
				}else{
					$keywordsMap['Digital'] = array($keyword);
				}
			}else{
				$array = $keywordsMap[strtoupper($c)];
				if(is_array($array)){
					$keywordsMap[strtoupper($c)][]=$keyword;
				}else{
					$keywordsMap[strtoupper($c)] = array($keyword);
				}
			}
		}
		$this->view->keywordsMap = $keywordsMap;
    
    }
    
    public function newyearAction(){
    	$this->view->styleName = 'blackfriday';
    	$this->view->webSiteTitle = 'New Year 2013 Soccer Jersey, 2013 Soccer Jersey';
    	$this->view->webSiteDescription = 'Save up to 80% for All Jerseys. Best Deals for New Year 2013! 2013 Big Sale!';
    	$this->view->webSiteKeywords = "New Year Soccer 2012, New Year Soccer Jersey 2012, 2013 Big Sale, Free Shipping";
    	$keywords = new Ckeywords();
    	$this->getHelper('Fenlei')->getCategories();
    	
		
		$where="is_showed=1 and zcshop_products.onsales=0";
        $itemShow=new CItemShow();
        $itemShow->setType('product');
        $itemShow->setWhere($where);
        $itemCounts=$itemShow->getAllItemCounts();
        $itemShow->setFromTo(array('counts'=>24,'from'=>0));
        $myorder = R_PRE."items.view_num DESC";
        $itemShow->setOrder($myorder);
        $itemArray=$itemShow->getAllItems();
        $this->view->assign('hotItemArray',$itemArray);
        
        $csearch = new CSearch();
		$relatedKeywordList = $csearch->searchKey('holiday,new year,2013,festival,weekend,vacation,gift', 'any', 300);
    	
    	$keywordsMap = array();
    	foreach($relatedKeywordList as $keyword){
			$c = substr($keyword['keywords'],0,1);
			$n = ord(strtoupper($c));
			if($n<65||$n>92){
				$array = $keywordsMap['Digital'];
				if(is_array($array)){
					$keywordsMap['Digital'][]=$keyword;
				}else{
					$keywordsMap['Digital'] = array($keyword);
				}
			}else{
				$array = $keywordsMap[strtoupper($c)];
				if(is_array($array)){
					$keywordsMap[strtoupper($c)][]=$keyword;
				}else{
					$keywordsMap[strtoupper($c)] = array($keyword);
				}
			}
		}
		$this->view->keywordsMap = $keywordsMap;
    
    }
 
 

    public function postAction()
    {
        //$this->_helper->viewRenderer->setNoRender();
        //$this->getHelper ('layout')->disableLayout ();
    }

}
